#/*************************************************************************
#    > File Name: examples/example_Folder.py
#    > Author: Yan Wang
#    > Mail: wangyan@imnu.edu.cn
#    > Created Time: 2022年06月22日 星期三 16时39分43秒
# ************************************************************************/
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
sys.path.append('../Lib/')
from Load_Lib import * 

print("The examples in this file are:")   
ex_name={"1":"Create_Folder"
,"2":"Create_Folder_from_File"
,"3":"Create_Folder_from_FileDir"
,"4":"Find_File"
,"5":"Show_All_File_Name_in_Folders"
,"6":"Show_All_SubFolder_Name_in_Folders"
,"all":"all examples"}    #字典，所有对应函数为Lib/Foldert_Operation.py
for key in ex_name:
	print(key, ex_name[key])       #if条件语句，如果key在ex_name里面，则输出eg：1 Create_Folder
num=input("请输入想要运行的例子：")


if num == "1" or num == ex_name["1"] or num == "all":
# Create_Folder 
# 两个参数(A,B),A为文件夹名称,B为文件夹位置
# 在dir_name下创建一个file_name的文件夹
# 最后输出为：./examples/test_output//test_folder/-----存疑？多了‘/’
	file_name="test_folder"
	dir_name ="./examples/test_output/"
	#Exhibit_Function(Create_Folder, [file_name, dir_name])


if num == "2" or num == ex_name["2"] or num == "all":
# Create_Folder_from_File 
# 两个参数(A,B),A为最后生成的文件夹名称,B是文件
# 创建文件夹,文件夹的名称根据输入的文件名去掉文件类型来决定
# 最后输出为：'./examples/test_output//test_folder_from_file/'------存疑？多了‘/’
	file_name="./examples/test_folder/test_folder_from_file.dat"
	dir_name ="./examples/test_output/"
	#Exhibit_Function(Create_Folder_from_File, [file_name,dir_name])


if num == "3" or num == ex_name["3"] or num == "all":
# Create_Folder_from_FileDir 
# 一个参数A,为源文件名称
# 创建文件夹,文件夹的名称根据输入的文件file_name路径去掉最后面的文件决定
# 最后输出为：'./examples/test_output/test_folder/sub_folder/'
	file_name="./examples/test_output/test_folder/sub_folder/test_folder_from_file.dat"
	#Exhibit_Function(Create_Folder_from_FileDir, [file_name])


if num == "4" or num == ex_name["4"] or num == "all":
# Find_File 
# 两个参数(A,B),A为输入的文件夹,B要找的目标文件
# 计算一个文件夹folder_name中，label文件的数目
# 最后返回为：找到./examples/test_input/ARCH_output/中所有run_01文件并列表
	folder_name="./examples/test_input/ARCH_output/"
	#label="sigh"
	label="run_01"
	pattern="_"
	Exhibit_Function(Find_File, [folder_name,label])

if num == "5" or num == ex_name["5"] or num == "all":
	folder_name="/home/yancy/Software/MG5/Events_mh_mch_10/THDM_CH_4b0j_1/Events/"
	Exhibit_Function(Show_All_File_Name_in_Folders, [folder_name])
	#Show_All_File_Name_in_Folders(folder_name)

if num == "6" or num == ex_name["6"] or num == "all":
	folder_name="/home/yancy/Software/MG5/Events_mh_mch_10/THDM_CH_4b0j_1/Events/"
	Exhibit_Function(Show_All_SubFolder_Name_in_Folders, [folder_name])

